let mysql=require('mysql');
let h=mysql.createConnection({host:"127.0.0.1",user:"root",password:"root",port:"3306",database:"yonghu"});
h.connect();

let t=new Date();
let time=t.getFullYear()+"/"+(t.getMonth()+1)+"/"+t.getDate()+" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds();
//console.log(time)

//增
let add="insert into unser values (null,'五五',215,'男','"+time+"','"+time+"')";
h.query(add,(err,data)=>{
    console.log(err);
    console.log(data);
})


// //删
let dele="delete from unser where yh_id=1";
h.query(dele,(err,data)=>{
    console.log(err);
    console.log(data);
})

//改
let update="update unser set yh_name='小陈',update_time='"+time+"' where yh_id=2"
h.query(update,(err,data)=>{
    console.log(err);
    console.log(data);
})


//查
let cha=function(page){
    let selec="select * from unser limit "+(6*page-6)+","+(6*page);
    h.query(selec,(err,data)=>{
        console.log(err);
        console.log(data);
    })
}

cha(1);
h.end();